/*
 * Created on Apr 4, 2005
 */
package org.vectrics.recruiter.struts;

import org.vectrics.hibernate.ThreadProperties;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.skill.SkillProvider;
import org.vectrics.skill.UserEvaluation;
import org.vectrics.skill.struts.UserSkillEntryTag;

/**
 * @author MMoore
 */
public class SelfSkillEntryTag extends UserSkillEntryTag {
	
	protected String getFormAction() {
		String path = getContextPath()  + "/profile/" 
				+ ThreadProperties.getUriDomainId() 
				+ "/skill/nextSkillEntry.do"; 
		return(path);
	}

	
	protected String getOwnerObjectId() {
		String evalId = this.getEvaluationId();
		if ((evalId == null) || (evalId.length() == 0)) {
			UserEvaluation userEval = RecruitServiceLocator.getSkillProvider().findLatestUserSelfEvaluation(this.getAuthPerson());
			evalId = "" + userEval.getId();
			this.setEvaluationId(evalId);
		}
		return(evalId);
	}

	public String getEvaluationId() {
		String evalId = super.getEvaluationId();
		if ((evalId == null) || (evalId.length() == 0)) {
			UserEvaluation userEval = RecruitServiceLocator.getSkillProvider().findLatestUserSelfEvaluation(this.getAuthPerson());
			evalId = "" + userEval.getId();
			this.setEvaluationId(evalId);
		}
		return(evalId);
	}

	
}
